---@class SkillEffect372100:BaseSkillEffect
SkillEffect372100 = ClientFight.CreateClass("SkillEffect372100",ClientFight.BaseSkillEffect)
local t = SkillEffect372100

function t:overrideTriggerSkill( parentSkill,  target, triggerSkillId)
self:triggerSkillsScript(parentSkill);
return true;
end
---@param skill FightUsingSkill
function t:triggerSkillsScript(skill)
    local fight = skill.fight
    local skillBean = ClientFight.SkillManager.getSkillBean(skill.skill.skillBean.f_SkillID, skill.fighter);
    local parameter = skillBean.f_SkillScriptParameter;
    --释放十八把匕首
    local skillId = parameter[1]--//匕首技能id,
    local num = parameter[2]--数量
    local dis = Utils.toRatio(parameter[3])--//半径(万分比)
    local inderectAngle = 360 / num;
    local fighterPos = skill.fighter.position
    local targetPos = skill.target.position
    local enemyTeam = fight.teams[3 - skill.fighter.teamIndex];
    local enemyPos = DistanceUtil.getLinePoint(fighterPos.x, fighterPos.y, targetPos.x, targetPos.y, dis);
    local enemyTemp = self:createTempFighter(fight,enemyTeam,enemyPos);
    ClientFight.SkillManager.triggerSkill(skill, enemyTemp,skillId);

    for i = 1, num -1 do
        enemyPos = DistanceUtil.calInderectPoint(fighterPos.x,fighterPos.y,targetPos.x,targetPos.y,dis,inderectAngle * i, 1);
        enemyTemp = self:createTempFighter(fight,enemyTeam,enemyPos);
        ClientFight.SkillManager.triggerSkill(skill, enemyTemp,skillId);
    end
end
---@param fight Fight
---@param parent Fighter
function t:createTempFighter(fight,enemyTeam,pos)
    ---@type Fighter
    local fighter = Fighter.New();
    fighter.fight = fight
    fighter.fightTeam = enemyTeam
    fighter.teamIndex = enemyTeam.teamIndex
    fighter.fighterId = fight.ids;
    fight.ids = fight.ids + 1
    fighter.leader = false

    --模型ID
    fighter.modelId = 9999
    fighter.star = 1
    fighter.level = 1
    fighter.position = pos
    local baseState = BaseState.New();
    baseState.state = bit.bor(baseState.state , FighterStateEnum.CAN_NOT_DAMAGE_BY_ENEMY:getState())
    baseState.state = bit.bor(baseState.state , FighterStateEnum.CAN_NOT_DAMAGE_BY_FRIENDLY:getState())
    baseState.state = bit.bor(baseState.state , FighterStateEnum.IMMUNITY:getState())
    fighter.totalState = baseState
    -- 英雄配置
    fighter.heroBean = DataManager.t_heroBeanMap[9999];
    -- 体型
    fighter.shape = Rectangle2.New(fighter.heroBean.f_HeroSize)
    -- 警戒范围1
    if (fighter.heroBean.f_WarningRange1 ~= nil) then
        fighter.alertRange1 = Rectangle2.New(fighter.heroBean.f_WarningRange1)
    end
    -- 警戒范围2
    if (fighter.heroBean.f_WarningRange2 ~= nil) then
        fighter.alertRange2 = Rectangle2.New(fighter.heroBean.f_WarningRange2)
    end

    --召唤物相关
    fighter.summons = false
    -- 初始开始血量
    fighter:setHp(1)
    return fighter;
end

t.New()